package com.dycloud.project.controller.user;

import com.dycloud.project.domain.Meetings;
import com.dycloud.project.enums.ReviewStatusEnum;
import com.dycloud.project.enums.ServiceTypeEnum;
import com.dycloud.project.service.IMeetingsService;
import com.dycloud.project.web.controller.BaseController;
import com.dycloud.project.web.domain.AjaxResult;
import com.dycloud.project.web.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author : renhang
 * @description MeetingsController
 * @date : 2025-07-03 14:04
 **/
@RestController
@RequestMapping("/user/meetings")
public class UserMeetingsController extends BaseController {
    @Autowired
    private IMeetingsService meetingsService;

    /**
     * 查询会议列表
     */
    @GetMapping("/list")
    public TableDataInfo list(Meetings meetings) {
        startPage();
        // 只能看到已发布的会议
        meetings.setStatus(ReviewStatusEnum.PUBLISHED.getCode());
        return meetingsService.selectMeetingsList(meetings, ServiceTypeEnum.MINI_PROGRAM.getCode());
    }


    /**
     * 获取会议详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(meetingsService.selectMeetingsById(id));
    }


}